/**
 * 
 */
package truerefactor.refactor;

import java.util.List;

import truerefactor.graph.ClassNode;
import truerefactor.graph.CodeGraph;
import truerefactor.graph.CodeNode;

/**
 * @author Isaac
 */
public class IntroduceNullObject extends Refactoring {

    public IntroduceNullObject()
    {
        this.shortName = "NULLOBJ";
        this.name = "Introduce Null Object";
        this.description = "";
    }

    /*
     * (non-Javadoc)
     * @see
     * truerefactor.refactor.Refactoring#execute(truerefactor.graph.CodeGraph )
     */
    @Override
    public void execute(CodeGraph graph)
    {
        // 1. create a subclass of the source class to act as a null version of
        // the classs.
        // create an isNull operation on the source class and the null class.
        // for the source class it should return false, for the null class it
        // should return true.
        createIsNullClass();
        createIsNullMethod();

        // 3. Find all places that can give out a null when asked for a source
        // object. Replace them to give out a null object instead.
        giveOutNullObjs();

        // 4. Find all places that compare a variable of the source type with
        // null and replace them with a call isNull
        insertIsNulls();

        // 6. Look for cases in which clients invoke an operation if not null
        // and do some alternative behavior if null
        // 7. For each of these cases override the operation in the null class
        // with the alternative behavior
        createAltBehavior();

        // 8. Remove the condition check for those that use the overriden
        // behavior
        removeConditions();
    }

    private void removeConditions()
    {
        // TODO Auto-generated method stub
        
    }

    private void createAltBehavior()
    {
        // TODO Auto-generated method stub
        
    }

    private void insertIsNulls()
    {
        // TODO Auto-generated method stub
        
    }

    private void giveOutNullObjs()
    {
        // TODO Auto-generated method stub
        
    }

    private void createIsNullMethod()
    {
        // TODO Auto-generated method stub
        
    }

    private void createIsNullClass()
    {
        // TODO Auto-generated method stub
        
    }
}
